-
Notifications
You must be signed in to change notification settings - Fork 671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Apache Drill Dialect to SqlGlot #707
Conversation
sqlglot/dialects/drill.py
Outdated
ESCAPES = ["\\"] | ||
ENCODE = "utf-8" | ||
|
||
KEYWORDS = {**tokens.Tokenizer.KEYWORDS, "VARBINARY": TokenType.BINARY} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you add varbinary? that's already a type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed. Drill doesn't have a BINARY
data type, just a VARBINARY
, so that's what I was trying to do here, but I think that is covered elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then it should instead be in the generator binary mapping to varbinary, look at what presto does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha.... and it's already there. 👍
sqlglot/sqlglot/dialects/drill.py
Lines 129 to 132 in f1f4fa2
exp.DataType.Type.SMALLINT: "INTEGER", | |
exp.DataType.Type.TINYINT: "INTEGER", | |
exp.DataType.Type.BINARY: "VARBINARY", | |
exp.DataType.Type.TEXT: "VARCHAR", |
this is a pretty good start, why don't we get this merged in and then fix the xlsx table afterwards? |
@tobymao I'd defer to you on that. Drill's SQL dialect follows ANSI 2003 pretty closely, so I don't anticipate there's much more do to. I'm happy to proceed if that's what you think is best. Going to sleep now, but tomorrow, I'll remove the unit test for the |
ok yea, let's just get this merged. it's nice and clean. the table function is going to be much harder |
This PR adds a dialect for Apache Drill to SQLGlot.
Remaining work:
table()
functiontable()
function.